/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('eds-yuanhua', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model GetDumpsResponseBody = {
  content?: any(name='Content'),
  errorCode?: int32(name='ErrorCode'),
  errorLevel?: string(name='ErrorLevel'),
  errorMsg?: string(name='ErrorMsg'),
  success?: string(name='Success'),
}

model GetDumpsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetDumpsResponseBody(name='body'),
}

async function getDumpsWithOptions(runtime: Util.RuntimeOptions): GetDumpsResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'GetDumps',
    version = '2022-08-18',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getDumps(): GetDumpsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getDumpsWithOptions(runtime);
}

model ShowTrackpointDataServiceRequest {
  desktopID?: string(name='DesktopID'),
  hostName?: string(name='HostName'),
  instanceID?: string(name='InstanceID'),
  timeBegin?: long(name='TimeBegin'),
  timeEnd?: long(name='TimeEnd'),
  dataType?: string(name='dataType'),
  module?: string(name='module'),
}

model ShowTrackpointDataServiceResponseBody = {
  errorCode?: long(name='ErrorCode'),
  errorLevel?: string(name='ErrorLevel'),
  errorMsg?: string(name='ErrorMsg'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  content?: any(name='content'),
}

model ShowTrackpointDataServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ShowTrackpointDataServiceResponseBody(name='body'),
}

async function showTrackpointDataServiceWithOptions(request: ShowTrackpointDataServiceRequest, runtime: Util.RuntimeOptions): ShowTrackpointDataServiceResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ShowTrackpointDataService',
    version = '2022-08-18',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function showTrackpointDataService(request: ShowTrackpointDataServiceRequest): ShowTrackpointDataServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return showTrackpointDataServiceWithOptions(request, runtime);
}

